<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>项目基本信息列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
         <div class="fieldBox col_50">
                <div class="label">金融机构</div>
                <div class="field">
                    <input name="fncinsNM" id="fncinsNM" type="text" class="ui-textbox" value="${fncinsNM}" >
                </div>
         </div>
          <div class="fieldBox col_50">    
            <div class="label">用户名</div>
                <div class="field">
                    <input name="insUser" id="insUser" type="text" class="ui-textbox" value="${insUser}" >
                </div>
          </div>
          <div class="fieldBox col_50">      
            <div class="label">真实名称</div>
                <div class="field">
                    <input name="insUserNm" id="insUserNm" type="text" class="ui-textbox" value="${insUserNm}" >
                </div>
                           
         </div>
            <div class="clearFix"></div>
            <div class="btnsBox">
               <span id="searchBtn" onclick="searchBtn();"  class="sq-button sq-button-round">查询</span>
               <span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
               <span id="addBtn" onclick="addBtn();" class="sq-button sq-button-round">新增</span>
            </div>

			
        </div>
    </form>
</div>
<div id="ligergrid1" class="sq-grid"></div> 
</div>

<script type="text/javascript">
	var grid = null;
	var queryFlag ="${queryFlag}"; //只查询列表
	$(function () {
	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/rfbuss/fncprjbscinfo/initInsUserList.do',
	    	method : 'get',	 
	    	
	        columns: [
	            { display: '金融机构', name: 'fncinsNM', minWidth: 140 , enabledSort:true}, 
	            
	            { display: '用户名', name: 'insUser', minWidth: 200 , enabledSort:true}, 
	            { display: '真实名称', name: 'insUserNm', minWidth: 200 , enabledSort:true}, 
	            { display: '操作',name: 'insUserNm', minWidth: 200 , enabledSort:true,
	            	render: function (rowdata, rowindex, value, column) { 
                		
                		var h = '<a class="sq-button-hasicon" href="javascript:detailBtn('+rowdata.fncinsid+",'"+rowdata.insUser+"')\">查看</a>";
                			h += '<a class="sq-button-hasicon" href="javascript:addBtn('+rowdata.fncinsid+",'"+rowdata.insUser+"')\">修改</a>";
                            return h;
                		},   	
                }
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:false,
	        
	        rownumbers:true
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	    
	
	
	});
	
	
	
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	function addBtn(fncinsid,insUser){
		var callback = function(){
			 grid.reload();
		}
		  var TAB=top.mainApp.parentTab;
          var currentTabid=TAB.getSelectedTabItemID();

		var timestamp=new Date().getTime();
		if(fncinsid){
			Add_navTab('fnc_prj_bsc_info_add'+timestamp,'修改配置信息','<%=path%>/rfbuss/fncprjbscinfo/toInsUserAddPage.do?flag=1&fncinsid='+fncinsid+'&insUser='+insUser,callback);
		}else{
			Add_navTab('fnc_prj_bsc_info_add'+timestamp,'添加配置信息','<%=path%>/rfbuss/fncprjbscinfo/toInsUserAddPage.do?flag=2',callback);
		}
		
	}
	
	function searchBtn(){
        var form = new liger.get("searchBar");
        var data = form.getData();
        for (name in data){
        //	alert(name+":"+data[name]);
           grid.setParm(name,data[name]);
        };
       grid.reload();
	}
	
	
	function detailBtn(fncinsid,insUser){
		
		Add_navTab('tab_project_detail'+fncinsid+insUser,'配置信息详情','<%=path%>/rfbuss/fncprjbscinfo/toInsUserAddPage.do?flag=0&fncinsid='+fncinsid+'&insUser='+insUser);
	}
	
	
	
 
  function clearBtn(){
    $("#searchBar").ligerForm();
			var form = new liger.get("searchBar");
			//form.clear(); 
			form.setData({
				fncinsNM:"",
				insUser:"",
				insUserNm:"",

			 });
	}
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    }
	}
	
	function fmoney(s, n)   
	{   
	   n = n > 0 && n <= 20 ? n : 2;   
	   s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + "";   
	   var l = s.split(".")[0].split("").reverse(),   
	   r = s.split(".")[1];   
	   t = "";   
	   for(i = 0; i < l.length; i ++ )   
	   {   
	      t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");   
	   }   
	   return t.split("").reverse().join("") + "." + r;   
	} 
</script>

</body>
</html>